<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="com.electric.entity.CustomRepairRecord,com.electric.common.Contains"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ include file="/WEB-INF/jsp/common/common.jsp"%>
<% 
CustomRepairRecord repairRecord = (CustomRepairRecord) request.getAttribute("repairRecord");
String code = Contains.VOLTAGE_LOSS_CODE;
%>
<style>
.upload-img {
	position: relative;
	overflow: hidden;
}

.upload-img input[type=file] {
	position: absolute;
	left: 0;
	top: 0;
	z-index: 1;
	width: 100%;
	opacity: 0;
	cursor: pointer;
	font-size: 50rem;
}

.controls .row-fluid {
	margin-bottom: 9px;
}

.img-row .controls .carousel .carousel-caption {
	display: none;
}

.img-row .controls .carousel:hover .carousel-caption {
	display: block;
}

.img-row .controls .carousel:hover .carousel-caption h4, .controls .carousel:hover .carousel-caption p
	{
	text-align: center;
}

#dataForm .control-group .control-label {
	width: 100px;
}

#dataForm .control-group .controls {
	margin-left: 120px;
}

.carousel .carousel-caption {
	display: none;
}

.carousel:hover .carousel-caption {
	display: block;
}

#dataForm #lossVoltageLevelParam .date input {
	width: 160px;
}

#dataForm #lossVoltageLevelParam .row-fluid {
	margin-bottom: 10px;
}

#dataForm #lossVoltageLevelParam .control-label.span4 {
	width: 31.914893617021278%;
	min-width: 64px;
}

#dataForm #lossVoltageLevelParam input {
	width: 100%;
}
</style>

<form id="dataForm" class="form-horizontal" style="margin-top: 32px;">
	<div class="control-group info check-group">
		<label class="control-label" for="repairTypeData">故障类型</label>
		<div class="controls">
			<select class="check-required" id="repairTypeData" name="repairType"
				disabled="disabled">
				<option value="">${repairRecord.repairTypeStr }</option>
			</select>
		</div>
	</div>
	<div class="control-group info check-group">
		<label class="control-label" for="voltageLevelData">电压等级</label>
		<div class="controls">
			<select class="check-required" id="voltageLevelData"
				name="voltageLevel" disabled="disabled">
				<option value="">${repairRecord.voltageLevelStr }</option>
			</select>
		</div>
	</div>
	<div class="control-group info check-group">
		<label class="control-label" for="customerNumberData">户号</label>
		<div class="controls">
			<c:if
				test="${not empty repairRecord.customerNumberStr and not empty repairRecord.customerName}">
				<c:set var="showCustomer"
					value="[${repairRecord.customerNumberStr }]${repairRecord.customerName }" />
			</c:if>
			<input class="disabled" type="text" id="customerNumberData"
				value="${showCustomer }" readonly="readonly" />
		</div>
	</div>
	<div class="control-group info check-group">
		<label class="control-label">故障日期</label>
		<div class="controls">
			<div class="input-append date" id="failureDate">
				<fmt:formatDate value="${repairRecord.failureDate}"
					pattern="yyyy-MM-dd" var="failureDate" />
				<input class="check-required" name="failureDate" size="16"
					type="text" value="${failureDate}" readonly /> <span class="add-on"><i
					class="icon-th"></i></span>
			</div>
		</div>
	</div>
	<div class="control-group info check-group">
		<label class="control-label">恢复日期</label>
		<div class="controls">
			<div class="input-append date" id="repairDate">
				<fmt:formatDate value="${repairRecord.repairDate}"
					pattern="yyyy-MM-dd" var="repairDate" />
				<input class="check-required" name="repairDate" size="16"
					type="text" value="${repairDate}" readonly /> <span class="add-on"><i
					class="icon-th"></i></span>
			</div>
		</div>
	</div>
	<div class="control-group info check-group">
		<label class="control-label" for="repairResult">处理结果</label>
		<div class="controls">
			<textarea readonly="readonly" id="repairResult" maxlength="300"
				style="height: 60px;">${repairRecord.repairResult }</textarea>
		</div>
	</div>
	<%
	if(repairRecord != null && code.equals(Contains.REPAIR_TYPE_ID_CODE.get(repairRecord.getRepairType()))){
	%>
		<div class="control-group info" id="lossVoltageLevelParam">
	<%
	} else {
	%>
		<div class="control-group info hide" id="lossVoltageLevelParam">
	<%
	}
	%>
	<div class="row-fluid">
		<div class="span12 check-group">
			<label class="control-label">失压前的日期1</label>
			<div class="controls">
				<div class="input-append date" id="beforeLossVoltageDate1">
					<input class="check-required" name="params[beforeLossVoltageDate1]"
						size="16" type="text"
						value="${repairRecordParameter.beforeLossVoltageDate1 }" readonly />
					<span class="add-on"><i class="icon-th"></i></span>
				</div>

			</div>
		</div>
	</div>
	<div class="row-fluid">
		<div class="span3 check-group">
			<label class="span4 control-label">[电量]总</label>
			<div class="span7">
				<input type="text" readonly name="params[beforeLossVoltageTotal1]"
					value="${repairRecordParameter.beforeLossVoltageTotal1 }"
					maxlength="6" />

			</div>
		</div>
		<div class="span3 check-group">
			<label class="span4 control-label">[电量]尖</label>
			<div class="span7">
				<input type="text" readonly name="params[beforeLossVoltageSharp1]"
					value="${repairRecordParameter.beforeLossVoltageSharp1 }"
					maxlength="6" />

			</div>
		</div>
		<div class="span3 check-group">
			<label class="span4 control-label">[电量]峰</label>
			<div class="span7">
				<input type="text" readonly name="params[beforeLossVoltagePeak1]"
					value="${repairRecordParameter.beforeLossVoltagePeak1 }"
					maxlength="6" />

			</div>
		</div>
		<div class="span3 check-group">
			<label class="span4 control-label">[电量]谷</label>
			<div class="span7">
				<input type="text" readonly name="params[beforeLossVoltageOffPeak1]"
					value="${repairRecordParameter.beforeLossVoltageOffPeak1 }"
					maxlength="6" />

			</div>
		</div>
	</div>

	<div class="row-fluid">
		<div class="span12 check-group">
			<label class="control-label">失压前的日期2</label>
			<div class="controls">
				<div class="input-append date" id="beforeLossVoltageDate2"
					data-date-format="yyyy-mm-dd">
					<input class="check-required" name="params[beforeLossVoltageDate2]"
						size="16" type="text"
						value="${repairRecordParameter.beforeLossVoltageDate2 }" readonly />
					<span class="add-on"><i class="icon-th"></i></span>
				</div>

			</div>
		</div>
	</div>
	<div class="row-fluid">
		<div class="span3 check-group">
			<label class="span4 control-label">[电量]总</label>
			<div class="span7">
				<input type="text" readonly name="params[beforeLossVoltageTotal2]"
					value="${repairRecordParameter.beforeLossVoltageTotal2 }"
					maxlength="6" />

			</div>
		</div>
		<div class="span3 check-group">
			<label class="span4 control-label">[电量]尖</label>
			<div class="span7">
				<input type="text" readonly name="params[beforeLossVoltageSharp2]"
					value="${repairRecordParameter.beforeLossVoltageSharp2 }"
					maxlength="6" />

			</div>
		</div>
		<div class="span3 check-group">
			<label class="span4 control-label">[电量]峰</label>
			<div class="span7">
				<input type="text" readonly name="params[beforeLossVoltagePeak2]"
					value="${repairRecordParameter.beforeLossVoltagePeak2 }"
					maxlength="6" />

			</div>
		</div>
		<div class="span3 check-group">
			<label class="span4 control-label">[电量]谷</label>
			<div class="span7">
				<input type="text" readonly name="params[beforeLossVoltageOffPeak2]"
					value="${repairRecordParameter.beforeLossVoltageOffPeak2 }"
					maxlength="6" />

			</div>
		</div>
	</div>

	<div class="row-fluid">
		<div class="span12 check-group">
			<label class="control-label">恢复后的日期1</label>
			<div class="controls">
				<div class="input-append date" id="afterRepairDate1"
					data-date-format="yyyy-mm-dd">
					<input class="check-required" name="params[afterRepairDate1]"
						size="16" type="text"
						value="${repairRecordParameter.afterRepairDate1 }" readonly /> <span
						class="add-on"><i class="icon-th"></i></span>
				</div>

			</div>
		</div>
	</div>
	<div class="row-fluid">
		<div class="span3 check-group">
			<label class="span4 control-label">[电量]总</label>
			<div class="span7">
				<input type="text" readonly name="params[afterRepairTotal1]"
					value="${repairRecordParameter.afterRepairTotal1 }" maxlength="6" />

			</div>
		</div>
		<div class="span3 check-group">
			<label class="span4 control-label">[电量]尖</label>
			<div class="span7">
				<input type="text" readonly name="params[afterRepairSharp1]"
					value="${repairRecordParameter.afterRepairSharp1 }" maxlength="6" />

			</div>
		</div>
		<div class="span3 check-group">
			<label class="span4 control-label">[电量]峰</label>
			<div class="span7">
				<input type="text" readonly name="params[afterRepairPeak1]"
					value="${repairRecordParameter.afterRepairPeak1 }" maxlength="6" />

			</div>
		</div>
		<div class="span3 check-group">
			<label class="span4 control-label">[电量]谷</label>
			<div class="span7">
				<input type="text" readonly name="params[afterRepairOffPeak1]"
					value="${repairRecordParameter.afterRepairOffPeak1 }" maxlength="6" />

			</div>
		</div>
	</div>

	<div class="row-fluid">
		<div class="span12 check-group">
			<label class="control-label">恢复后的日期2</label>
			<div class="controls">
				<div class="input-append date" id="afterRepairDate2"
					data-date-format="yyyy-mm-dd">
					<input class="check-required" name="params[afterRepairDate2]"
						size="16" type="text"
						value="${repairRecordParameter.afterRepairDate2 }" readonly /> <span
						class="add-on"><i class="icon-th"></i></span>
				</div>

			</div>
		</div>
	</div>
	<div class="row-fluid">
		<div class="span3 check-group">
			<label class="span4 control-label">[电量]总</label>
			<div class="span7">
				<input type="text" readonly name="params[afterRepairTotal2]"
					value="${repairRecordParameter.afterRepairTotal2 }" maxlength="6" />

			</div>
		</div>
		<div class="span3 check-group">
			<label class="span4 control-label">[电量]尖</label>
			<div class="span7">
				<input type="text" readonly name="params[afterRepairSharp2]"
					value="${repairRecordParameter.afterRepairSharp2 }" maxlength="6" />

			</div>
		</div>
		<div class="span3 check-group">
			<label class="span4 control-label">[电量]峰</label>
			<div class="span7">
				<input type="text" readonly name="params[afterRepairPeak2]"
					value="${repairRecordParameter.afterRepairPeak2 }" maxlength="6" />

			</div>
		</div>
		<div class="span3 check-group">
			<label class="span4 control-label">[电量]谷</label>
			<div class="span7">
				<input type="text" readonly name="params[afterRepairOffPeak2]"
					value="${repairRecordParameter.afterRepairOffPeak2 }" maxlength="6" />

			</div>
		</div>
	</div>
	<div class="row-fluid">
		<div class="span5 check-group">
			<label class="span4 control-label">CT倍率</label>
			<div class="span7">
				<input type="text" readonly name="params[CTRatio]"
					value="${repairRecordParameter.CTRatio }" maxlength="6" />

			</div>
		</div>
		<div class="span5 check-group">
			<label class="span4 control-label">PT倍率</label>
			<div class="span7">
				<input type="text" readonly name="params[PTRatio]"
					value="${repairRecordParameter.PTRatio }" maxlength="6" />

			</div>
		</div>
       
       <div class="row-fluid">
      	<div class="span12">
	      	<label class="control-label" style="width: 100%;text-align: left;margin-left: 5px;">失压期间后追补电量</label>
        </div>
      </div>
      
      <div id="calculateResult">
      <div class="row-fluid">
      	<div class="span3">
	      	<label class="span4 control-label">[电量]总</label>
	        <div class="span7">
	          <input type="text" value="${calculateParameter.resultArray[0] }" disabled />
	        </div>
        </div>
      </div>
      <div class="row-fluid">
        <div class="span3">
	      	<label class="span4 control-label">[电量]尖</label>
	        <div class="span7">
	          <input type="text" value="${calculateParameter.resultArray[1] }" disabled />
	        </div>
        </div>
        <div class="span3">
	      	<label class="span4 control-label">[电量]峰</label>
	        <div class="span7">
	          <input type="text" value="${calculateParameter.resultArray[2] }" disabled />
	        </div>
        </div>
        <div class="span3">
	      	<label class="span4 control-label">[电量]谷</label>
	        <div class="span7">
	          <input type="text" value="${calculateParameter.resultArray[3] }" disabled />
	        </div>
        </div>
        <div class="span3">
	      	<label class="span4 control-label">[电量]平</label>
	        <div class="span7">
	          <input type="text" value="${calculateParameter.resultArray[4] }" disabled />
	        </div>
        </div>
      </div>
      </div>
	</div>
	</div>
	<div class="control-group info">
		<label class="control-label">现场图片</label>
		<div class="controls">
			<c:if test="${empty repairRecord.pictures}">
			<div class="row-fluid img-row"></div>
			</c:if>
			<c:forEach items="${repairRecord.pictures}" var="c" varStatus="s">
				<c:if test="${s.index % 3 eq 0}">
					<div class="row-fluid img-row">
				</c:if>

				<div class="span4 carousel">
					<img class="featurette-image pull-left"
						src="${basePath }/${c.filePath}">
					<div class="carousel-caption">
						<h4 class="one-line">${c.fileName}</h4>
						<p>
						<div class="btn-group" style="margin: 9px 0 5px;">
							<span class="btn" onclick="openImage(this)">查看原图</span> <a
								class="btn" href="${basePath}/${c.filePath}" target="_blank">在新窗口打开</a>
							<span class="btn" onclick="delImage(this,'${c.seqId}')">删除图片</span>
							<input type="hidden" name="imgSeqIds" value="${c.seqId }" />
						</div>
						</p>
					</div>
				</div>

			<c:if test="${(s.index + 1) % 3 eq 0 or s.last}">
			</div>
			</c:if>
			</c:forEach>

		</div>
	</div>
	<input type="hidden" name="seqId" value="${repairRecord.seqId }" />
</form>
<%
if(repairRecord == null || !code.equals(Contains.REPAIR_TYPE_ID_CODE.get(repairRecord.getRepairType()))){
%>
<script>
debugger;
var btn = $("#dataForm").closest(".layui-layer-page").find(".layui-layer-btn1");
btn.remove();
</script>
<%
} 
%>